package otheri.download;

import java.io.IOException;

import otheri.io.Input;
import otheri.io.Output;
import otheri.io.Serializable;

public class DownloadConfig implements Serializable {

	/*
	 * 最多同时下载任务数
	 */
	public int runningTaskLimit = 1;

	/*
	 * 下载任务失败重试次数
	 */
	public int taskErrorRetryTimes = 5;

	/*
	 * 下载任务失败重试等待时间（十秒）
	 */
	public int taseErrorRetryWaitTime = 10000;

	public void serialize(Output out) throws IOException {
		out.writeInt(runningTaskLimit);
		out.writeInt(taskErrorRetryTimes);
		out.writeInt(taseErrorRetryWaitTime);
	}

	public void deserialize(Input in) throws IOException {
		runningTaskLimit = in.readInt();
		taskErrorRetryTimes = in.readInt();
		taseErrorRetryWaitTime = in.readInt();
	}
}
